<template>
	<div class="easyd-weixin-Box">

		<div class="app_page_box" style="bottom:50px;">
			<div class="app_page">

				<div class="app_list_box MARGIN_BOTTOM_10">
					<div class="app_box_content">
						<div class="app_box_content_textarea">
							<textarea maxlength="500" name="" v-model="objectionData.txt" rows="8" cols="" placeholder="文字描述你所反馈的问题！"></textarea>
						</div>
						<span class="textarea_num C4">{{objectionData.txt.length}}/500</span>
					</div>
				</div>

				<div class="app_list_box">
					<div class="app_box_content" @click="feedbackType()">
						<div class="app_box_content_left">
							反馈类型
						</div>
						<div class="app_box_content_right">
							<span class="T3 C4">
								<span v-if="objectionData.typeId">{{feedbackTypeArr[objectionData.typeId]}}</span>
								<span v-else>请选择</span>
							</span>
							<span class="fa fa-angle-right fa-lg C2"></span>
						</div>
					</div>
				</div>
				
			</div>
		</div>
		<div class="app_bottom_box">
			<div class="app_bottom_box_right" @click="submitFeedback()">提交反馈</div>
		</div>

	</div>
</template>

<script>
	import { mapState, mapMutations } from "vuex";

	export default {

		data() {
			return {
				feedbackTypeArr: ['行业知识', '产品知识',  '销售技巧'], //反馈类型
			};
		},
		computed: {
			...mapState({
				objectionData: state => state.ObjectionModule.objection,
			}),
		},
		mounted() {

			//          this.initData()

		},
		methods: {

			//  ...mapMutations(["ShopIndexModule/updateIsShopGuide"]),

			submitFeedback() {
				var param = {
					is_master:this.$userData.getIsManager(),
					u_id:this.$userData.getUID(),
					os_id:this.$userData.getOsid(),
					sq_nickname:this.$userData.getOsName(),
					sq_type:this.objectionData.typeId,
					sq_content:this.objectionData.txt.replace(/\n/g,''),
				};

				console.log(param);
				this.$easyUtil.startLoading(this)
				this.$http.postHttp(this.$API.feedbackAdd, param, (rs) => {

					this.$easyUtil.endLoading(this)
					this.$easyUtil.successToast(this, '反馈提交成功');
					this.$store.commit('ObjectionModule/clearObjectionData');
					history.go(-1);

				})
			},

			//反馈类型
			feedbackType() {
				this.$router.push({
					path: '/feedbackType'
				})
			},
		}
	};
</script>

<style lang="stylus" scoped>
	@import '~PUBLIC_CSS';
	.textarea_num {
		position: absolute;
		bottom: 1px;
		right: 10px;
		background: #fff;
	}
	
</style>